﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        
        // Set up the website's information
        SMBL.Global.WebSiteInfo.Ins().WebSiteName = "SundayMaker";
        SMBL.Global.WebSiteInfo.Ins().WebSiteOwner = "SM-Team";
        SMBL.Global.WebSiteInfo.Ins().WebSiteUrl = "127.0.0.1";
        // Load the config file 
        // And start the basic error system
        SMBL.Global.WebSite.Boot();
        // Cache the config file and 
        // Start the error system and log system
        SMBL.Core.Kernel.Initialize();
        
        // Start the ControlCenter
        SMBL.Control.ControlCenter.Initialize();
        
        // Resigter Website services.
        WSReg.WebServicesRegister();
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

        SMBL.Control.ControlCenter.Terminate();
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
        Exception exp = Server.GetLastError();

        // Process the exception
        SMBL.Global.BasicErrorSystem.UnhandledError(exp);

        Server.ClearError();
        
        // Redirect to some page?
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
